import Vue from 'vue';
import Main from './main.vue';
const NoticeConstructor = Vue.extend(Main);
let index = 1;

const notice = (options = {}) => {
    const data = {
        id: `notice_${index++}`,
        visible: true,
    };
    const instance = new NoticeConstructor({ propsData: options, data }).$mount();
    document.body.appendChild(instance.$el);
    instance.$el.style.zIndex = options.zIndex || (10000 + index++);
    return instance;
};

export default notice;
